export default function (attrString){//' class="aa bb cc" id="dd"'
    if(!attrString) return [];
	//结果数组
	let result=[];
	//判断空格位置的标记
	let isInnerSapce = false;
	//指针
	let startPointer=0;
	let endPointer =0;
	//循环遍历
	for(let i=0;i<attrString.length;i++){
		let item = attrString[i];
		if(item=='"'){
			isInnerSapce = !isInnerSapce;
		};
		if(item ==' ' && !isInnerSapce){
			// console.log(item,i,startPointer)
			let char = attrString.substring(startPointer,i);
			if(!/^\s*$/.test(char)){
				result.push(char.trim());
				startPointer = i;
			};
			

		}
	};
	//循环结束后将最后一个k='v'加入进来
	result.push(attrString.substring(startPointer).trim());
	//映射处理结果
	let res = result.map(function(item){
		let reg = /(.+)=(.+)/;
		let o = item.match(reg);
		// console.log(o)
		return {
			name:o[1],
			value:o[2]
		}
	})
	// console.log('处理完后的result=》',result);
	return res

}